<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    x:Class="OpenLS.Chart.UI.AreaChartResources"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:chart="http://schemas.Kherty.com/office/2007/chart"
  xmlns:chartui="clr-namespace:OpenLS.Chart.UI"
  xmlns:drawing="http://schemas.Kherty.com/office/2007/drawing"
  xmlns:drawing2="clr-namespace:OpenLS.Drawing.UI;assembly=OpenLS.Drawing.UI"
  xmlns:Internals="clr-namespace:OpenLS.Chart.UI.Internals"
>
    <ResourceDictionary.MergedDictionaries>
        <chartui:Axis2DResources/>
    </ResourceDictionary.MergedDictionaries>

    <DataTemplate DataType="{x:Type chart:AreaChart}">
        <Grid
      chartui:ChartElement.Chart="{Binding}"
      drawing:DrawingElement.ColorScheme="{Binding RelativeSource={RelativeSource Self}, Path=(drawing2:DrawingElement.Theme).ColorScheme}"
        
            chartui:ChartElement.XAxisInfo="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.Observer).MaxIndex, Converter={x:Static Internals:ChartConverters.SimpleAxisInfoFactory}}">
            <chartui:ChartElement.Observer>
                <MultiBinding Converter="{x:Static Internals:ChartConverters.SeriesObserverFactory}">
                    <Binding Path="Series"/>
                    <Binding Path="Grouping"/>
                </MultiBinding>
            </chartui:ChartElement.Observer>

            <chartui:ChartElement.YAxisInfo>
                <MultiBinding Converter="{x:Static Internals:ChartConverters.AxisInfoFactory}">
                    <Binding Path="VerticalAxis.Minimum"></Binding>
                    <Binding Path="VerticalAxis.Maximum"></Binding>
                    <Binding Path="(chartui:ChartElement.Observer).ActualMinimum" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="(chartui:ChartElement.Observer).Maximum" RelativeSource="{RelativeSource Self}"/>
                </MultiBinding>
            </chartui:ChartElement.YAxisInfo>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height ="Auto"/>
            </Grid.RowDefinitions>
            <ContentPresenter Content="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.PlotArea)}"
                          ContentTemplate="{x:Static chartui:PlotAreaResources.PlotAreaBackgroundTemplate}"
                          Grid.Row="1" Grid.Column="1"/>
            <ContentPresenter Content="{Binding VerticalAxis}" Name="verticalAxis"
        Grid.Row="1" Grid.Column="0" 
        chartui:AxisElement.Orientation="Vertical"
        chartui:AxisElement.Minimum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.YAxisInfo).Minimum}"
        chartui:AxisElement.Maximum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.YAxisInfo).Maximum}">
            </ContentPresenter>
            <Grid Grid.Row="2" Grid.Column="1" Name="categoryAxisHolder" chartui:AxisElement.ItemsSource="{Binding Categories.Values}" >
                <ContentPresenter Name="categoryAxis"
                              Content="{Binding HorizontalAxis}"
                              chartui:AxisElement.Orientation="Horizontal"
                                chartui:AxisElement.Maximum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.XAxisInfo).Maximum}"
                              />
            </Grid>
            <Grid Grid.Row="1" Grid.Column="1" 
                chartui:AxisElement.Minimum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.YAxisInfo).Minimum}"
                chartui:AxisElement.Maximum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.YAxisInfo).Maximum}"
                  chartui:AxisElement.Orientation="Vertical">
                <ContentPresenter  Name="minorGrid">
                    <chartui:AxisElement.MinorStep>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMinorStepConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                        </MultiBinding>
                    </chartui:AxisElement.MinorStep>
                    <ContentPresenter.Content>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMinorInfoConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.MinorStep)"/>
                            <Binding Path="VerticalAxis"/>
                            <Binding Path="VerticalAxis.MinorGridLines"/>
                        </MultiBinding>
                    </ContentPresenter.Content>
                </ContentPresenter>
                <ContentPresenter Name="majorGrid">
                    <chartui:AxisElement.MajorStep>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMajorStepConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                        </MultiBinding>
                    </chartui:AxisElement.MajorStep>
                    <ContentPresenter.Content>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMajorInfoConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.MajorStep)"/>
                            <Binding Path="VerticalAxis"/>
                            <Binding Path="VerticalAxis.MajorGridLines"/>
                        </MultiBinding>
                    </ContentPresenter.Content>
                </ContentPresenter>
            </Grid>
            <ItemsControl Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Path=Series}"  ToolTip="{x:Static Internals:UIStringTable.PlotArea}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Grid/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </ItemsControl>

        </Grid>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding VerticalAxis.Position}" Value="{x:Static chart:AxisPosition.Right}">
                <Setter TargetName="verticalAxis" Property="Grid.Column" Value="2"></Setter>
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>

</ResourceDictionary>